package com.msb.service.Controller;

import com.msb.internalcommon.dto.ResponseResult;
import com.msb.internalcommon.request.VerificationCodeDTO;
import com.msb.service.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Auther: jiudianliu
 * @Date: 2023/5/19 - 05 - 19 - 15:54
 * @Description: com.msb.service.Controller
 * @version: 1.0
 */
@RestController
public class UserController {

    @Autowired
    private UserService userService ;

    @PostMapping("/user")
    public ResponseResult loginOrRegister(@RequestBody VerificationCodeDTO verificationCodeDTO){
        String passengerPhone = verificationCodeDTO.getPassengerPhone();
        System.out.println("手机号："+ passengerPhone);
        return userService.loginOrRegister(passengerPhone);
    }
    @GetMapping("/user/{phone}")
    public ResponseResult getUser(@PathVariable("phone") String passengerPhone) {
        return userService.getUserByPhone(passengerPhone) ;
    }
}
